package shootingtactics.client.core;

import com.google.gwt.canvas.dom.client.Context2d;
import com.google.gwt.canvas.dom.client.CssColor;

public class DrawingCore{

    public Position position;

    String drawType;

    CssColor drawColor;

    public Context2d bulletContext;

    public DrawingCore(double posX, double posY, String drawType, CssColor drawColor, Context2d targetContext){
        position = new Position(posX, posY);
        this.drawType = drawType;
        this.drawColor = drawColor;
        this.bulletContext = targetContext;
    }

    public void setDraw(){
        bulletContext.setFillStyle(drawColor);
        if(drawType.equals(Constant.DRAW_TYPE_ARC)){
            bulletContext.arc(position.getDrawPositionX(), position.getDrawPositionY(), position.getRadius(), 0, Math.PI * 2.0, true);
            bulletContext.fill();
        }else if(drawType.equals(Constant.DRAW_TYPE_RECTANGLE)){
            bulletContext.fillRect(position.getDrawPositionX(), position.getDrawPositionY(), position.getWidth(), position.getHeight());
        }
    }
}
